<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/calendar.js"></script>
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
function personDialog(rowNum){
	var url = "./contract.do?action=selectSalePerson";
	var dlgParam = "dialogHeight:350px;dialogWidth:400px;dialogTop:300px;dialogLeft:400px;status:no;help:no;scrollbars:yes;";
	var rt = window.showModalDialog(url,"",dlgParam);
	if(rt != undefined){
		//根据从子窗口得到的值，从中提取销售代表id和销售代表名称
		var personId = "";
		var person = "";
		var tStr = rt.split(",");
		if(tStr[0] != 0 && tStr[1] != 0){
			personId = tStr[0];
			person = tStr[1];
		}
		document.getElementById("personId").value = personId;
		document.getElementById("person").value = person;

	}
}

function checkForm()
{
	return true;
}

function initPage(){
	newTrNum = table1.rows.length;//表格最大行号，只增不减
	
	if("<c:out value='${result}'/>" == 1){
		alert("<fmt:message key='common.message.addSuccess'/>");
	}
}

function save(){
	if(checkForm()){
		document.addOfficialCostForm.action = "./contract.do?action=confirmCost";
		document.addOfficialCostForm.target = "main";
		document.addOfficialCostForm.submit();
	}
}
-->
</script>
</head>
<body onload="initPage()">
<form name="addOfficialCostForm" action="" method="post">
<input id="id" name="id" type="hidden" value="${cost.id}"/>
<input id="costType" name="costType" type="hidden" value="${cost.costType}"/>
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab" colspan="2">
							官费
						</td>
					</tr>
					<tr>
						<td align="center" valign="bottom">
							<input class="btn_submit" type="button" value="核销" onclick="save()" hidefocus="true"/>
							&nbsp;&nbsp;
							<input class="btn_back" type="button" value="取消并返回" onclick="back()" hidefocus="true"/>
						</td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td valign="top">
				<table class="table_title2">
					<tr>
						<td>
							<table class="table_add">
								<tr>
									<td class="title_top">官费编号</td>
									<td class="title_top">计划付款日期</td>
									<td class="title_top">付款账户信息</td>
									<td class="title_top">总金额</td>
									<td class="title_top">申请人</td>
								</tr>								
								<tr>
									<td>
										<input id="costId" name="costId" type="text" style="width:100px" value="${cost.costId}"/>
									</td>									
									<td>
										<input id="paymentDate" name="paymentDate" type="text" style="width:100px"
											onclick="calendar(this,'yyyy-MM-dd');" readonly="readonly" value="${cost.paymentDateStr}"/>
									</td>
									<td>
										<input id="paymentAccount" name="paymentAccount" type="text" style="width:100px" value="${cost.paymentAccount}"/>
									</td>
									<td>
										<input id="costTotal" name="costTotal" type="text" style="width:100px" value="${cost.costTotal}"/>
									</td>		
									<td>
										<c:choose>
											<c:when test="${isViewAllContract == 1}">
											<input id="person" name="person" type="text" value="${cost.personName}" readonly="readonly"/>
											</c:when>
											<c:otherwise>${userName}</c:otherwise>
										</c:choose>
										<input id="personId" name="personId" type="hidden" value="${cost.personId}"/>
										<c:if test="${isViewAllContract == 1}">
										<input class="btn_select" type="button" value="" onclick="personDialog()" hidefocus="true"/>
										</c:if>	
									</td>																	
								</tr>								
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td>
							<table class="table_add">
								<tr>
									<td class="title_top" width="60">案件明细</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td valign="top">
							<table id="table1" class="table_style">
								<tr>
									<td class="title" width="15%">合同号</td>
									<td class="title" width="15%">商品名称</td>
									<td class="title" width="23%">官费</td>
								</tr>
								<c:if test="${cost.costType == 'officialCost' }">
									<c:forEach var="contractCase" items="${cost.officalCCList}">
										<tr>
											<td>
												<input id="conId" name="conId" class="input_percent" type="text" value="${contractCase.contract.contractCode}" readonly/>
											</td>
											<td>
												<input id="contractCaseFullName" name="contractCaseFullName" type="text" value="${contractCase.contractCaseFullName}" readonly/>
											</td>		
											<td>
												<input id="officialCost" name="officialCost" type="text" value="${contractCase.officialCost}" readonly/>
											</td>																																				
										</tr>
									</c:forEach>
								</c:if>
								<c:if test="${cost.costType == 'operationCost' }">
									<c:forEach var="contractCase" items="${cost.operationCCList}">
										<tr>
											<td>
												<input id="conId" name="conId" class="input_percent" type="text" value="${contractCase.contract.contractCode}" readonly/>
											</td>
											<td>
												<input id="contractCaseFullName" name="contractCaseFullName" type="text" value="${contractCase.contractCaseFullName}" readonly/>
											</td>		
											<td>
												<input id="officialCost" name="officialCost" type="text" value="${contractCase.operationCost}" readonly/>
											</td>																																				
										</tr>
									</c:forEach>
								</c:if>								
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>